import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    // redirect: "/userLogin"
    // redirect: "/login"
    redirect: "/overview"
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/login.vue')
  },
  {
    path: '/userLogin',
    name: 'userLogin',
    component: () => import('@/views/login/userLogin.vue')
  },
  {
    path: "/overview",
    name: "订餐首页",
    component: () => import("@/views/overview/index.vue")
  },
  {
    path: "/goodsDetail",
    name: "goodsDetail",
    component: () => import("@/views/overview/components/goodsDetail.vue")
  },
  {
    path: "/shoppingCart",
    name: "购物车",
    component: () => import("@/views/overview/components/shoppingCart.vue")
  },
  {
    path: "/userCenter",
    name: "userCenter",
    component: () => import("@/views/overview/userCenter.vue")
  },

  //  这个没有用
  // {
  //   path: "/payGateWay",
  //   name: "payGateWay",
  //   component: () => import("@/views/shopCenter/goodsList/apply/apply.vue")
  // },


  // {
  //   // path: "/userInfo",
  //   path: "/admin/shop",
  //   name: "用户中心",
  //   component: () => import("@/views/index/userInfo.vue")
  // },

  {
    path: '/index',
    name: '后台首页',
    redirect: '/user/shop',
    component: () => import('@/views/index/index.vue'),
    children: [
      {
        path: '/admin/system',
        component: () => import('@/views/system/menusManagement/index.vue'),
      },
      // 菜单管理
      {
        path: '/admin/menu/list',
        component: () => import('@/views/system/menusManagement/index.vue')
      },
      // 角色管理
      {
        path: '/admin/role/list',
        component: () => import('@/views/system/roleManagement/index.vue')
      },
      // 管理员管理
      {
        path: '/admin/user/list',
        component: () => import('@/views/system/adminManagement/index.vue')
      },
        // 日志管理
      {
        path: '/system/operator_log_list',
        component: () => import('@/views/system/logManagement/index.vue')
      },
      // 数据备份管理
      {
        path: '/admin/database_bak/list',
        component: () => import('@/views/system/dataBackUpManagement/index.vue')
      },

      {
        // path: "/userInfo",
        path: "/admin/shop",
        name: "用户中心",
        component: () => import("@/views/index/userInfo.vue")
      },



      {
        path: "/admin/shop/list",
        name: "店铺列表",
        component: () => import("@/views/shopsManagement/index.vue")
      },

        // ========================== 个人中心 ================================

      {
        path: "/user/shop",
        name: "我的店铺",
        component: () => import("@/views/shopCenter/myShop/index.vue")
      },
      {
        path: "/user/shop/goods",
        name: "店铺商品列表",
        component: () => import("@/views/shopCenter/goodsList/index.vue")
      },
      {
        path: "/admin/shop/order",
        name: "订单中心",
        component: () => import("@/views/shopCenter/orderList/index.vue")
      },




      {
        path: "/admin/typeinfo/list",
        name: "分类列表",
        component: () => import("@/views/typeManagement/index.vue")
      },

      // 全部商品列表
      {
        path: "/admin/goods/list",
        name: "全部商品列表",
        component: () => import("@/views/allGoodsList/index.vue")
      },

      // 管理员全部订单列表
      {
        path: "/admin/order/list",
        name: "全部订单列表",
        component: () => import("@/views/allOrderList/index.vue")
      },

    ]
  }
  // {
  //   path: '/main',
  //   name: '主程序',
  //   component: () => import('@/views/register/register.vue'),
  //   redirect: '/index'
  // }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
